package androcr.client.mobile.services.servicechooser;

import androcr.client.mobile.core.Controller;
import androcr.client.mobile.display.servicechooser.IServiceChooserActivity;
import androcr.client.mobile.display.texttospeech.ITextToSpeechActivity;
import androcr.client.mobile.services.fileuploader.IUploadCompleteListener;
import android.content.Context;
import android.speech.tts.TextToSpeech;
import android.speech.tts.TextToSpeech.OnInitListener;

public class ServiceChooserPresenter implements IServiceChooserPresenter, IUploadCompleteListener{
	private static final String TAG = "CameraPresenter";
	
	private IServiceChooserActivity serviceChooserActivity;
	private boolean isMessageReceived = false;
	

	public ServiceChooserPresenter(IServiceChooserActivity serviceChooserActivity) {
		this.serviceChooserActivity = serviceChooserActivity;
		
		if (!isMessageReceived){
			Controller.getInstance().uploadFile((IUploadCompleteListener)this, (Context)serviceChooserActivity, Controller.getInstance().getPictureData());
		}
	}


	@Override
	public void isComplete() {
		serviceChooserActivity.setRecognizedText(Controller.getInstance().getActualRecognizedText());
	}


	@Override
	public void updateString() {
		Controller.getInstance().setActualRecognizedText(serviceChooserActivity.getEditedText());
	}


	@Override
	public void startTranslatorService(Context context) {
		Controller.getInstance().startTranslator(context);
	}

	@Override
	public void startTextToSpeechService(Context context) {
		Controller.getInstance().startTextToSpeechService(context);
	}


	@Override
	public void startWebSearchService(String text) {
		Controller.getInstance().startWebSearchService((Context) serviceChooserActivity, text);
	}
}
